<template>
	<view>
		<!-- 页首 -->
		<zw-header></zw-header>
		<!-- 左侧导航栏 -->
		<menu-wrapper active-index="2-1" style="background-color: #fff;padding: 0;">
			<view style="background-image: url('/static/image/user/vip/bg.png');height: 1000px;">
				<view style="display: flex;justify-content: center;align-items: center;">
					<view class="card-header">
						<view class="left" style="color: #C7B480;padding-top: 100rpx;">
							<view>
								<view style="display: flex;justify-content: center;align-items: center;">
									<fui-avatar background="#fff" width="180" :src="loginUser.avator"
										style="top: 48%;"></fui-avatar>
								</view>
								<view class="user-info">
									<view class="user-name elip" style="margin-top: 30rpx;">{{loginUser.name}}</view>
									<view style="margin-top: 30rpx;">
										<view class="">
											已加入设辑318天
										</view>
									</view>
								</view>
							</view>
						</view>
						<view class="right">
							<view class="item">
								<view class="name" style="margin: 40rpx;">
									<view>AI创作服务</view>
								</view>
								<view style="display: flex;justify-content: center;align-items: center;" >
									<view class="card" style="width: 33%;" @click="goUrl('/pages/works/works')">
										<view style="padding: 60rpx; 0 60rpx 0">
											<view>
												<image src="/static/image/ai/fb.png" style="width: 50rpx;"
													mode="widthFix"></image>
											</view>
											<view style="margin-top: 20rpx;">我的创作</view>
										</view>
									</view>
									<view class="card" style="width: 33%;" @click="goUrl('/pages/post/post')">
										<view style="padding: 60rpx; 0 60rpx 0">
											<view>
												<image src="/static/image/ai/fb.png" style="width: 50rpx;"
													mode="widthFix"></image>
											</view>
											<view style="margin-top: 20rpx;">我的贴子</view>
										</view>
									</view>
									<view class="card" style="width: 33%;" @click="show=true">
										<view style="padding: 60rpx; 0 60rpx 0">
											<view>
												<image src="/static/image/ai/fb.png" style="width: 50rpx;"
													mode="widthFix"></image>
											</view>
											<view style="margin-top: 20rpx;">我要发布</view>
										</view>
									</view>
								</view>

							</view>
							<view class="item" style="margin-top: 60rpx;">
								<view class="name" style="margin: 40rpx;">数据中心</view>
								<view>
									<view style="display: flex;justify-content: center;align-items: center;">
										<view style="color: #FFFFFF;font-size: 28rpx;text-align: center;width: 25%;">
											<view>18</view>
											<view>作画</view>
										</view>
										<view style="border: 1px solid #404040;transform: rotate(90deg);width: 80rpx;">
										</view>
										<view style="color: #FFFFFF;font-size: 28rpx;text-align: center;width: 25%;">
											<view>3</view>
											<view>发布作品</view>
										</view>
										<view style="border: 1px solid #404040;transform: rotate(90deg);width: 80rpx;">
										</view>
										<view style="color: #FFFFFF;font-size: 28rpx;text-align: center;width: 25%;">
											<view>0</view>
											<view>被同款</view>
										</view>
										<view style="border: 1px solid #404040;transform: rotate(90deg);width: 80rpx;">
										</view>
										<view style="color: #FFFFFF;font-size: 28rpx;text-align: center;width: 25%;">
											<view>0</view>
											<view>被同款</view>
										</view>
									</view>
								</view>
								<view style="display: flex;justify-content: center;align-items: center;">
									<view class="card" style="width: 50%;">
										<view style="padding: 60rpx; 0 60rpx 0">
											<view>
												<image src="/static/image/ai/fb.png" style="width: 50rpx;"
													mode="widthFix"></image>
											</view>
											<view style="margin-top: 20rpx;">AI创作数据</view>
										</view>
									</view>
									<view class="card" style="width: 50%;">
										<view style="padding: 60rpx; 0 60rpx 0">
											<view>
												<image src="/static/image/ai/fb.png" style="width: 50rpx;"
													mode="widthFix"></image>
											</view>
											<view style="margin-top: 20rpx;">粉丝数据</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

			</view>
		</menu-wrapper>
		<!-- 页脚 -->
		<!-- <zw-footer></zw-footer> -->
		<fui-landscape :show="show" :closable="closable" @close="closePopup">
			<view class="fui-ani__box"
				style="background-color: #fff;border-radius: 28rpx;width: 850rpx;height: 900rpx;">
				<view class="flex-center"
					style="height:120rpx;display: flex;justify-content: space-between;align-items: center;padding: 0 40rpx 0 40rpx;">
					<view style="color: #000000;font-weight: bold;font-size: 48rpx;">我要发布</view>
					<image src="/static/image/user/content/close.png" style="width:80rpx;" mode="widthFix" @click="closePopup">
					</image>
				</view>
				<view style="padding:80rpx;">
					<view style="display: flex;justify-content: space-between;align-items: center;margin-top: 80rpx;" @click="goUrl('/pages/myPhoto/myPhoto')">
						<view style="display: flex;justify-content: center;align-items: center;">
							<view>
								<image src="/static/image/user/content/fb.png" style="width:80rpx;" mode="widthFix">
								</image>
							</view>
							<view style="padding-left: 40rpx;">
								<view style="font-size: 48rpx;font-weight: bold;color: #000000;">发布AI创作</view>
								<view style="font-size: 32rpx;font-weight: 500;color: #666666;">分享你的画作和指令</view>
							</view>
						</view>
						<view>
							<image src="/static/image/user/content/jt.png" style="width:22rpx;" mode="widthFix"></image>
						</view>
					</view>
					<view style="display: flex;justify-content: space-between;align-items: center;margin-top: 100rpx;" @click="goUrl('/pages/publish/post')">
						<view style="display: flex;justify-content: center;align-items: center;">
							<view>
								<image src="/static/image/user/content/tz.png" style="width:80rpx;" mode="widthFix">
								</image>
							</view>
							<view style="padding-left: 40rpx;">
								<view style="font-size: 48rpx;font-weight: bold;color: #000000;">发布帖子</view>
								<view style="font-size: 32rpx;font-weight: 500;color: #666666;">分享你的AI调教经验和趣事</view>
							</view>
						</view>
						<view>
							<image src="/static/image/user/content/jt.png" style="width:22rpx;" mode="widthFix"></image>
						</view>
					</view>
					<view style="display: flex;justify-content: space-between;align-items: center;margin-top: 100rpx;" @click="goUrl('/pages/works/works')">
						<view style="display: flex;justify-content: center;align-items: center;">
							<view>
								<image src="/static/image/user/content/jh.png" style="width:80rpx;" mode="widthFix">
								</image>
							</view>
							<view style="padding-left: 40rpx;">
								<view style="font-size: 48rpx;font-weight: bold;color: #000000;">发布合集</view>
								<view style="font-size: 32rpx;font-weight: 500;color: #666666;">分享你的创作主题合集</view>
							</view>
						</view>
						<view>
							<image src="/static/image/user/content/jt.png" style="width:22rpx;" mode="widthFix"></image>
						</view>
					</view>
				</view>
			</view>
		</fui-landscape>
	</view>
</template>

<script>
	import menuWrapper from '@/components/user/common/menu-wrapper.vue';
	import centerConfig from '@/common/config/user/center.config.js';
	import onYangWxTable from '@/components/onYang-wxTable/onYang-wxTable.vue';
	import {
		mapState
	} from 'vuex';

	export default {
		components: {
			menuWrapper,
			onYangWxTable
		},
		data() {
			return {
				...centerConfig,
				accountInfo: {},
				counts: [],
				width: 0,
				tabIndex: 1,
				cardIndex: 1,
				show: false,
				closable: false

			}
		},
		computed: {
			...mapState(['loginUser']),
			currentTime() {
				const currentHour = new Date().getHours();
				const timeQuantums = ['凌晨', '上午', '下午', '晚上'];
				return timeQuantums[Math.floor(currentHour / 6)];
			}
		},
		onLoad() {
			this.getAccountInfo();
			this.findCounts();
			this.$store.commit('tab', 0);

		},
		onReady() {
			let that = this;
			const query = uni.createSelectorQuery();
			//获取宽度
			query.select('.item').fields({
				size: true
			}, (res) => {
				console.log('item', res)
				that.width = res.width;
				const height = res.height;
			}).exec();
		},
		methods: {
			closePopup() {
				this.show = false
			},
			goUrl(url) {
				uni.navigateTo({
					url: url,
					fail(err) {
						console.log(err)
					}
				})
			},
			clickCard(index) {
				this.cardIndex = index;
				// this.page = 0;
				// this.promos = [];
				// this.findPicture();
			},
			clickOption(index) {
				this.tabIndex = index;
				// this.page = 0;
				// this.promos = [];
				// this.findPicture();
			},
			getAccountInfo() {
				this.$util.request('/security/getAccountInfo', {}, (res) => {
					this.accountInfo = res.accountInfo;
				}, true);
			},
			findCounts() {
				uni.showLoading({
					title: '加载中...',
					mask: true
				});
				this.$util.request('/profile/counts', {}, (res) => {
					uni.hideLoading();
					this.counts = res;
				}, true);
			}
		}
	}
</script>

<style lang="scss">
	.card {
		background: #2C2C2C;
		margin: 40rpx;
		border-radius: 30rpx;
	}

	.card3 {
		color: #885DD6;
		background: linear-gradient(114deg, #D3C2FF 5%, #D3BAFC 45%, #AB94FE 87%);
	}

	.card2 {
		color: #C08049;
		background: radial-gradient(123% 123% at 0% 10%, #FFECC1 0%, #EAA771 99%);
	}

	.card1 {
		color: #7B91A5;
		background: radial-gradient(55% 55% at 13% 5%, #D8E5EA 0%, #C9D9DE 100%);
	}

	.lable {
		font-family: 思源黑体;
		font-size: 16px;
		font-weight: bold;
		line-height: normal;
		text-align: center;
		display: flex;
		align-items: center;
		letter-spacing: 0em;

		color: #666666;
	}

	.active {
		font-family: 思源黑体;
		font-size: 16px;
		font-weight: bold;
		line-height: normal;
		display: flex;
		align-items: center;
		letter-spacing: 0em;
		border-bottom: 2px solid #080808;
		color: #000000;
	}

	.banner {
		width: 100%;
		height: 200px;
		margin: 0 auto;
		display: flex;
		justify-content: center;
	}

	.avatar {
		width: 100px;
		height: 100px;
		padding: 4px;
		border: 3px solid #FFFFFF;
		border-radius: 100px;
		object-fit: fill;
	}

	.card-header {
		display: block;
		width: 100%;
		// padding-top: 24px;
		// justify-content: space-between;
		@extend %flex-align-center;

		.left {
			.user-info {
				text-align: center;
				color: #FFFFFF;

				.user-name {
					font-family: Source Han Sans;
					font-size: 24px;
					font-weight: bold;
				}

				.tip {
					font-family: Source Han Sans;
					font-size: 16px;
					font-weight: normal;
					font-feature-settings: "kern" on;
					color: #FFFFFF;
				}

				.link {
					display: inline-block;
					font-size: 12px;
					margin-top: 10px;
					color: $color-primary;
				}
			}
		}

		.right {
			margin-top: 170rpx;

			.item {
				@extend %flex-align-center;
				background: #1D1D1F;
				border-radius: 40rpx;
				padding: 0 34rpx 0 34rpx;
				// margin-left: 66rpx;
				color: #757575;
				display: block;
				text-align: center;

				.value {
					font-family: HarmonyOS Sans SC;
					font-size: 18px;
					font-weight: bold;
					line-height: 35px;
					text-align: center;
					letter-spacing: 0px;
					color: #000000;
				}

				.name {
					text-align: left;
					font-family: Source Han Sans;
					font-size: 36rpx;
					font-weight: bold;
					font-feature-settings: "kern" on;
					color: #FFFFFF;
				}
			}

		}
	}

	.card-body {
		display: flex;
		flex-wrap: wrap;
		margin-top: 5px;
		padding-top: 50px;
		border-top: 1px solid $border-color;

		.button {
			margin-bottom: 60px;
			@extend %flex-align-center;

			.btn-icon {
				width: 100px;
				height: 100px;
				border-radius: 50%;
			}

			.right {
				width: 276px;
				margin-left: 20px;

				.top {
					@extend %flex-align-center;
					font-size: 18px;
					font-weight: 400;

					.name {
						color: #757575;
					}

					.value {
						color: $color-primary;
					}
				}

				.link {
					line-height: 1.8;
					@extend %flex-align-center;
					color: #757575;
					cursor: pointer;

					&:hover {
						color: $color-primary;
					}

					.icon {
						font-weight: bold;
					}
				}
			}
		}
	}
</style>